import BuffUtil from '@/BuffUtil';
import SelectUtil from '@/SelectUtil';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 恐怖嚎叫
 **/
export default class MSK_Kongbuhaojiao extends AbilityBase {
    static instance: MSK_Kongbuhaojiao;
    buffType: AppBuffType = {
        id: 'buff_MSK_Kongbuhaojiao',
        art: this.art,
        name: this.abilityName,
        ubertip: this.ubertip,
        attribute: {
            attack: -150,
            法术强度: -75,
            附加护甲: -100,
            附加魔抗: -100,
        },
        targetAttach: 'origin',
        targetArt: 'Abilities\\Spells\\Other\\HowlOfTerror\\HowlTarget.mdl',
        dur: 6,
        isDebuff: true,
    };
    constructor(id: string = 'Msm4') {
        super(id);
        MSK_Kongbuhaojiao.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        let es = SelectUtil.getEnemyUnitsInRange(source, 800);
        for (let e of es) {
            BuffUtil.addBuff(e, this.buffType.id);
        }
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
